"use strict";

const Service = require("egg").Service;

class HomeService extends Service {
    async findCodeByMobile(mobile) {
        let sql = "select * from code where mobile = ?";
        let parmas = [mobile];
        let res = await this.app.mysql.query(sql, parmas);
        return res[0];
    }
    async saveCode(mobile, code) {
        let sql = "insert into code (mobile, code) values (?, ?)";
        let parmas = [mobile, code];
        let res = await this.app.mysql.query(sql, parmas);
        return res;
    }
}
module.exports = HomeService;
